package com.manager.core.master.factory;

import android.util.Log;
import yyee.llee.mmee.base_api_factory.ModuleConfig;
import yyee.llee.mmee.base_api_net.base_api_bean.AdListBean;
import com.manager.core.master.scope.AdParams;
import com.manager.core.ad.adview.AdControImp;
import com.manager.core.ad.adview.AdViewControleListener;
import com.manager.core.ad.imp.IViewOnCloseListenerImpl;
import com.manager.core.pl190.host668.AdRealInterceptorChain;
import com.manager.core.pl190.host668.JWAdBase;
import java.util.Objects;

public class AdFactory {

    private static final String TAG = ModuleConfig.AD_LOG_TAG;

    public static AdViewControleListener createAdView(AdParams AdParams, AdListBean adBean, IViewOnCloseListenerImpl iViewOnCloseListener) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        AdViewControleListener adViewControler = new AdControImp();
        AdRealInterceptorChain.getInstance().createInterceptersChain(AdParams.getActivity().get(), adBean, t -> {
            if (t.isLoadSucess()) {
                JWAdBase ad = t.getAd();
                Log.d(TAG, "AdBaseFactory createAdView callback load success,ad:" + ad);
                adViewControler.setAdBaseInter(ad);
                if (t.getAd().isNeedContentViewShow()) {
                    adViewControler.show(adBean, Objects.requireNonNull(AdParams.getContinaer()).get(), AdParams.getActivity().get(), iViewOnCloseListener);
                } else {
                    adViewControler.show(adBean, AdParams.getActivity().get(), iViewOnCloseListener);
                }
            } else {
                Log.d(TAG, "AdBaseFactory createAdView callback load fail");
                iViewOnCloseListener.onComplete();
            }
        });
        return adViewControler;
    }
}
